







[This topic is pre-release documentation and is subject to change in future releases. Blank topics are included as placeholders.]
Create an array with the items in a collection.
Namespace: Wintellect.PowerCollections
Assembly:
PowerCollections (in PowerCollections.dll)
Syntax
C# |
---|
public static T[] ToArray<T>( IEnumerable<T> collection ) |
Visual Basic (Declaration) |
---|
Public Shared Function ToArray(Of T) ( _ collection As IEnumerable(Of T) _ ) As T() |
Visual C++ |
---|
public: generic<typename T> static array<T>^ ToArray ( IEnumerable<T>^ collection ) |
Parameters
- collection
- IEnumerable<(Of <T>)>
Collection to create array from.
Return Value
An array with the items from the collection, in enumeration order.
Type Parameters
- T
- Element type of the collection.
Remarks
If collection implements ICollection<T>T, then
ICollection<T>.CopyTo() is used to fill the array. Otherwise, the IEnumerable<T>.GetEnumerator()
is used to fill the array.
Exceptions
Exception | Condition |
---|---|
System..::ArgumentNullException | collection is null. |
See Also
Algorithms Class
Wintellect.PowerCollections Namespace